#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <string.h>
void reverse(char* left,char* right)
{
	while (left < right)
	{
		char tmp = *left;
		*left = *right;
		*right = tmp;
		left++;
		right--;
	}

}
int main()
{
	char arr[101] = { 0 };
	fgets(arr, 100, stdin);
	int len = strlen(arr);
	reverse(arr,arr+len-1);
	char* start = arr;
	char* run = arr;
	while (*run)
	{
		while(*run != ' ' && *run != '\0')
		{
			run++;
		}
		reverse(start, run - 1);
		start = run + 1;
		if (*run == ' ')
		{
			run++;
		}
	}

	printf("%s\n", arr);
	return 0;
}